<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>修改自定义表字段</title>
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/plugins/iCheck/custom.css">
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/style.css">
    <link rel="stylesheet" type="text/css" href="/static/layer/skin/layer.css">
    <style type="text/css">
        .form-control{width: 290px;}
        .control-label{width: 100px;text-align: right}
        .col-sm-10{display: inline-block}
        .radio label{padding-left: 0;margin-right: 10px;}
        .must {color: #ff0000;font-size: 19px;float: right;margin-left: 5px;}
        .field_values{width: 380px}
        .fk{margin: 5px 0;display: inline-block;width: 80px}
        .fv{margin: 5px 0;display: inline-block;width: 150px}
        .wb{margin-left: 10px;}
        .symbol{display: inline-block;font-size: 22px;font-weight: bolder;margin-left: 10px;cursor: pointer;}
        .plus{color: #880000}
        .minus{color: #ACCD3C}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-content">
                    <form class="form-horizontal" onsubmit="return false">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">所属表<span class="must">*</span></label>
                            <div class="col-sm-10">
                                <select class="form-control" id="table_name" name="table_name">
                                    <option value="">…请选择…</option>
                                    {foreach $tables as $t}
                                    <option value="{$t.TABLE_NAME}" {if($field.table_name===$t.TABLE_NAME)}selected="selected"{/if}>{$t.TABLE_COMMENT}</option>
                                    {/foreach}
                                </select>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">字段名<span class="must">*</span></label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control" id="field_txt" name="field_txt" autocomplete="off" value="{$field.field_txt}" style="display: inline-block"><input type="checkbox" id="is_force" name="is_force" class="checkbox checkbox-inline" style="margin:0 10px;"><label for="is_force">强制修改字段</label>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">字段类型<span class="must">*</span></label>
                            <div class="col-sm-10">
                                <div class="radio i-checks">
                                    {foreach $types as $k=>$t}
                                    <label class>
                                        <div class="iradio_square-green">
                                            <input type="radio" value="{$k}" name="field_type" {if($field.field_type===$k)}checked="checked"{/if} style="position: absolute; opacity: 0;">
                                            <ins class="iCheck-helper"></ins>
                                        </div>
                                        {$t}</label>
                                    {/foreach}
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">排序</label>
                            <div class="col-sm-10">
                                <input type="number" class="form-control" id="sort" name="sort" autocomplete="off" value="{$field.sort}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label" style="vertical-align: top;margin-top: 8px;">可选项</label>
                            <div class="col-sm-10 field_values">
                                {if($field.field_type==='radio'||$field.field_type==='select')}
                                {foreach $field.field_value as $k=>$v}
                                <p>
                                    <span class="va">值：</span><input type="text" class="form-control fk" name="fk[]" value="{$v.key}"><span class="wb">文本：</span><input type="text" class="form-control fv" name="fv[]" value="{$v.value}">{if($k===0)}<span class="symbol plus">＋</span>{else/}<span class="symbol minus">－</span>{/if}
                                </p>
                                {/foreach}
                                {/if}
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="/static/hplus/js/jquery.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/hplus/js/plugins/iCheck/icheck.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/layer/layer.js?v={php}echo time(){/php}"></script>
<script type="text/javascript">
    $(function () {
        $(".i-checks").iCheck({checkboxClass: "icheckbox_square-green", radioClass: "iradio_square-green"});
        $('.plus').click(function () {
            $('.field_values').append('<p><span class="va">值：</span><input type="text" class="form-control fk" name="fk[]"><span class="wb">文本：</span><input type="text" class="form-control fv" name="fv[]"><span class="symbol minus">－</span></p>')
        })
        $('.field_values').on('click', '.minus', function () {
            $(this).parent().remove()
        })
    });
</script>
</html>
